<?php

class StationController extends Controller {
    
    public function indexAction () {
        $model_station = new StationModel();
        $this->stations = $model_station->getStations();
        
        return 'station/index';
    }
    
    public function addAction () {
        if (! $_POST) {
            
            return 'station/add';
        } else {
            $value['name'] = $_POST['name'];
            $value['line'] = $_POST['line'];
            
            $model_station = new StationModel();
            if ($model_station->insert($value)) {
                $this->redirect('notify/success');
            } else {
                $this->redirect('notify/error');
            }
        }
    }

}
?>